/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package UI;

import diskfilesystem.Disk;
import java.awt.Color;
import java.awt.Graphics;

/**
 *
 * @author Administrator
 */
public class JPane extends javax.swing.JPanel {

    Disk disk;

    /**
     * Creates new form JPane
     */
    public JPane() {
        initComponents();
    }

    public JPane(Disk disk) {
        this();
        this.disk = disk;
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.setColor(Color.red);
        int count = 1, y = 20,x=18;
        for (int i = 0; i < 2; i++) 
            for(int j=0;j<disk.BLOCK_LENGTH;j++){
            if (disk.block[i][j] == 0) {
                g.drawRect((i*disk.BLOCK_LENGTH+j) * 32%512+x, y, 20, 20);
            } else {
                g.fillRect((i*disk.BLOCK_LENGTH+j) * 32%512+x, y, 20, 20);
            }
            if (count++ % 16==0) {
                y += 25;
            }
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
